Release 10.1A: OpenEdge Development:
ProDataSets
Defining the right granularity for your ProDataSets
A ProDataSet can represent one or more tables (and any external data structure that can be mapped to it). Often, of course, a single object or document in your application has a complex structure that requires multiple levels of master-detail relationships. This is what the multiple tables of a ProDataSet can be used for.
What then is the right size for your ProDataSets?
There is no single right answer to this question, but if you think of your ProDataSets as representing business objects or documents your application manages, then you should be able to define the right scope for them. Even with such a simplified database as the Progress Sports2000 database that we have been using to illustrate the use of the ProDataSet, you can identify some combinations of tables that can properly be thought of as single business objects and some that probably can’t.
For example, an
Orderis a common object in many applications. Generally, anOrderhas a header record. This is likely the right choice for the top level of anOrderProDataSet. TheOrderLinesfor anOrdercan then be a separate table in the same ProDataSet, if you think of theOrderLinesas being a part of theOrder.Are the
Itemrecords then also a part of theOrder? Well, probably not, even though we have added anItemtemp-table to theOrderProDataSet in these examples so that we can demonstrate certain things about how ProDataSets work. TheItemidentifier is a part of eachOrderLine, but theItemlist or catalog itself is really independent of any particularOrder. You might decide that having a separate temp-table in anOrderProDataSet that lets you pull inItemdetail information for all theItemsused in a particularOrderis a useful way to represent the data, as we have done in some of these examples. This is perfectly legitimate if it suits your purposes, but that is different from how you think of theItemcatalog as a whole.In this situation, ProDataSets let you define multiple levels of granularity and then combine them as you need to. For example, you can define an
Itemtemp-tablettItemand anItemProDataSetdsItemto representItemsas objects in their own right. You could use this ProDataSet to present a list of allItemsor allItemsthat satisfy some selection. Having a ProDataSet that contains just one table is perfectly reasonable. Even though there are no relations within the ProDataSet, the ProDataSet structure still provides services for you to manage theItems. For example, it could provide a common internal definition for thettItemtable and perhaps commonFILLlogic to map the externalItemsonto the internal temp-table, as shown in Figure 9–1.Figure 9–1: ProDataSets and data granularity
![]()
In Figure 9–1,
itemSource.prepresents a procedure that manages the Data-Source andFILLlogic for thettItemtable. This is the kind of procedure we’ll use to build a simple example later in this section.You could then use this same
ttItemtemp-table and any of its logic as part of a larger ProDataSet, such as anOrderProDataSet that wants to presentItemsused in theOrder, as shown in Figure 9–2.Figure 9–2: Reusing temp-table buffers
![]()
Note that while you can’t actually make a ProDataSet such as
dsItema part of another ProDataSet, you can make its temp-tables part of another ProDataSet such asdsOrderby using a different buffer for the temp-table. Because theSET-CALLBACK-PROCEDUREmechanism lets you associate event procedures in any running procedure with a ProDataSet event, you can combine logic from multiple support procedures in a single ProDataSet.
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |